package com.surprise.webcommon.util;

import java.util.List;

import com.surprise.webcommon.AppStatusCode;
import com.surprise.webcommon.bo.CommonResponse;

/**
 * ResponseUtils.java
 * @author nick
 * 2015年2月10日
 */
public class ResponseUtils {
    public static CommonResponse paramErrResponse(List<String> errMsgs) {
        StringBuilder sb = new StringBuilder();
        sb.append("参数错误: ");
        for (String errMsg : errMsgs) {
            sb.append(errMsg).append(",");
        }
        sb.deleteCharAt(sb.lastIndexOf(","));
        sb.append("\n");
        return new CommonResponse(AppStatusCode.PARAMETER_ERROR, sb.toString());
    }

    public static CommonResponse appNotExistResponse() {
        return new CommonResponse(AppStatusCode.APP_NOT_EXISTS, "应用不存在");
    }
}
